
**********************
**********************
*Replication Code for

*Hansen, Eric R., and Sarah A. Treul. "Prior Experience and State Legislative Effectiveness." Legislative Studies Quarterly.

*Compiled by Eric Hansen, 4/17/25 (ehansen4@luc.edu)
*Using Stata 18.5 SE.
**********************
**********************

*set your working directory
*cd "YourFilepath"

*open data

use "Hansen_Treul_LSQ_Replication_Data.dta"

************
*Table A1 - Summary Statistics
************

sum SLES bill_norm aic_norm abc_norm pass_norm law_norm SLES_ratio lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate inc priorlower prioroffice localprior stateleg

**************
*Table 1
**************

regress SLES priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress bill_norm priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if senate==1, vce(cluster sles_id)
regress aic_norm priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if senate==1, vce(cluster sles_id)
regress abc_norm priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if senate==1, vce(cluster sles_id)
regress pass_norm priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if senate==1, vce(cluster sles_id)
regress law_norm priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if senate==1, vce(cluster sles_id)

**************
*Figure 1
**************

regress SLES priorlower comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
margins, at(priorlower==(0 1))
marginsplot, recast(bar) title("") ytitle(Predicted Effectiveness Score, margin(medium)) xtitle("") xlabel(0 "No Prior House Service" 1 "Prior House Service") yscale(range(0(0.5)2)) ylabel(0 0.5 1 1.5 2) xscale(range(-0.75(0.5)1.75)) graphregion(fcolor(white)) ciopts(col(gs4) msize(medlarge) lwidth(medthick)) plot1opts(barw(0.5) color(gs8)) yline(1, lstyle(refline))

**************
*Table A2
**************

*recode data to note which senators ever had prior house experience regardless of their incumbency status
gen temp = (exper == 3 | exper == 6)
bysort sles_id (temp): egen max_temp = max(temp)
bysort sles_id (temp): gen pasthouse = max_temp
drop temp max_temp
label var pasthouse "Prior House Service" 

regress SLES pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress bill_norm pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress aic_norm pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress abc_norm pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress pass_norm pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)
regress law_norm pasthouse comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party if senate==1, vce(cluster sles_id)

**************
*Table 2
**************
*combine mayors and local executives into one category
gen mayorlocalexec = mayor + localexec

*combine DAs, judges, elected law enforcement (e.g. sheriff), and others into one category
gen otherlocal = legal + lawenforcement + other

*identify legislators without local experience
gen nolocal = stateleg + localcouncil + mayorlocalexec + schoolboard + otherlocal
recode nolocal (0=1) (1=0) (*=.)

*table entries
sum stateleg localcouncil mayorlocalexec schoolboard otherlocal nolocal

**************
*Table 3
**************

regress SLES localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress bill_norm localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress aic_norm localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm  pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress abc_norm localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress pass_norm localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress law_norm localprior stateleg comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)

**************
*Table 4
**************

regress SLES lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress bill_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress aic_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress abc_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress pass_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress law_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)

**************
*Table A3
**************

regress SLES lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)
regress bill_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)
regress aic_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)
regress abc_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)
regress pass_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)
regress law_norm lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate if seniority==1, vce(cluster sles_id)

**************
*Table A4
**************

*generate lagged DV
sort sles_id term_start
by sles_id: gen lagSLES = SLES[_n-1]

*summary stats for table a1
sum lagSLES

*original model
regress SLES lawyer government poladv comm_chair Leader_speakerpres Leader_majleader Leader_minleader power_comm seniority pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)

*drop seniority, majority, and committee chair variables since these are used to create benchmark
label var lagSLES "Lagged SLES"
regress SLES_ratio lawyer government poladv Leader_speakerpres Leader_majleader Leader_minleader power_comm pred_bla pred_his female ideo_med_distance gov_same_party senate lagSLES, vce(cluster sles_id)


**************
*Table A5
**************

logit comm_chair lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
logit Leader lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
logit power_comm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
nbreg seniority lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)

**************
*Table A6
**************

regress SLES lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress bill_norm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress aic_norm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress abc_norm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress pass_norm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
regress law_norm lawyer government poladv pred_bla pred_his female in_majority ideo_med_distance gov_same_party senate, vce(cluster sles_id)
